package com.mti.epivisitemobile.controller
{
	import com.mti.epivisite.common.event.EpivisiteEvent;
	import com.mti.epivisite.common.event.EventProxy;
	import com.mti.epivisite.common.event.EventProxyBase;
	import com.mti.epivisitemobile.Constants;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	public class LoadPoiCommand extends SimpleCommand
	{
		public function LoadPoiCommand()
		{
			super();
		}
		
		override public function execute(note:INotification):void
		{
			var proxy:EventProxyBase = EventProxyBase(facade.retrieveProxy(EventProxyBase.NAME));
			
			var data:Array = String(note.getBody()).split("-");
			
			if ((data.length != 3) || (data[0] != "Epivisite"))
			{
				return;
			}
			 
			proxy.load(String(data[1]));
			proxy.poiName = data[2];
			sendNotification(Constants.SHOW_MEDIA_LIST);
		}
	}
}